﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JsiCommon.javaScriptInterop
{
    class JsiActionSequence:IJsiExpression
    {
        private readonly IEnumerable<IJsiExpression> _expressions;

        public JsiActionSequence(IEnumerable<IJsiExpression> expressions)
        {
            _expressions = expressions;
        }

        public void Compile(StringBuilder builder)
        {
            if(!_expressions.Any())
                return;
            builder.Append("{");
            foreach (var jsiExpression in _expressions)
            {
                jsiExpression.Compile(builder);
                builder.Append("; ");
            }
            builder.Append("}");
        }
    }
}
